package com.gin.fanbox.api;

import com.gin.fanbox.call.FanboxCall;
import com.gin.fanbox.client.FanboxClient;
import com.gin.fanbox.param.PostListCreatorParam;
import com.gin.fanbox.param.PostListHomeParam;
import com.gin.fanbox.response.*;

/**
 * @author bx002
 * @since 2024/2/5 15:49
 */
public class FanboxApi {
    /**
     * 查询作品信息
     *
     * @param client 客户端
     * @param postId 作品id
     * @return call
     */
    public static FanboxCall<PostInfoDetail> postInfo(FanboxClient client, long postId) {
        return client.call("post.info", PostInfoDetail.class, "postId", String.valueOf(postId));
    }

    /**
     * 查询关注作者的最新作品
     *
     * @param client 客户端
     * @param param  参数
     * @return call
     */
    public static FanboxCall<PostListHome> postListHome(FanboxClient client, PostListHomeParam param) {
        return client.call("post.listHome", PostListHome.class, param);
    }

    /**
     * 查询指定作者作品
     *
     * @param client 客户端
     * @param param  参数
     * @return call
     */
    public static FanboxCall<PostListCreator> postListCreator(FanboxClient client, PostListCreatorParam param) {
        return client.call("post.listCreator", PostListCreator.class, param);
    }

    /**
     * 查询创作者作品分页地址
     *
     * @param client    客户端
     * @param creatorId 创作者id
     * @return call
     */
    public static FanboxCall<PostPaginateCreator> postPaginateCreator(FanboxClient client, String creatorId) {
        return client.call("post.paginateCreator", PostPaginateCreator.class, "creatorId", creatorId);
    }


    /**
     * 查询创作者信息
     *
     * @param client    客户端
     * @param creatorId 创作者id
     * @return call
     */
    public static FanboxCall<CreatorInfo> creatorGet(FanboxClient client, String creatorId) {
        return client.call("creator.get", CreatorInfo.class, "creatorId", creatorId);
    }

    /**
     * 查询关注的创作者
     *
     * @param client 客户端
     * @return call
     */
    public static FanboxCall<PostListFollowing> creatorListFollowing(FanboxClient client) {
        return client.call("creator.listFollowing", PostListFollowing.class, null);
    }


}
